home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / DTS Japan-Sample Code / QuickTime•MacApp2.0•6.0.7 / UDemoText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-05  |  4.9 KB  |  169 lines  |  [TEXT/MPS ]

  1. /* Copyright © 1991 by Taro Tanaka, Japan DTS, Apple Computer Japan, Inc. All rights reserved. */
  2.  
  3. /* Copyright © 1989 - 1990 by Apple Computer, Inc. All rights reserved. */
  4. /* UDemoText.p */
  5.  
  6.  
  7. /*
  8.     This sample application demonstrates the breadth of alternatives
  9.     available when using the MacApp building-block "UTEView" for text-editing.
  10. */
  11.  
  12. #ifndef __UDEMOTEXT__
  13. #define __UDEMOTEXT__
  14. #include "UMacApp.h"
  15. #include "UPrinting.h"
  16. #include "UTEView.h"
  17. #include "ToolUtils.h"
  18. #include "Fonts.h"
  19. #include "Errors.h"
  20. #include "Memory.h"
  21. #include "Resources.h"
  22. #include "Script.h"
  23. #include "Picker.h"
  24. #include "Files.h"
  25. #include <GestaltEqu.h>
  26. #include "StandardFile.h"
  27.                             //---------- QuickTime GM Interface
  28. #include "Components.h"
  29. #include "ImageCompression.h"
  30. #include "Movies.h"
  31. #include "MoviesFormat.h"
  32. #include "QuickTimeComponents.h"
  33. #endif
  34.  
  35. #define cImportMovie    1600
  36.  
  37.  
  38. const unsigned long kSignature            = 'yuki';        /* application signature */
  39. const unsigned long kFileType            = 'TEXT';        /* file-type code for saved disk files --
  40.                                                           uses standard text files */
  41.                                                           
  42. const unsigned long kMoovRsrcType        = 'moov';
  43.  
  44. const short kWindowRsrcID        = 1004;                    /* 'view' template for a DemoText window */
  45. const short kViewRsrcID            = 1005;                    /* 'view' template for a DemoText view */
  46.  
  47.                                                         /* Additional document specifications */
  48. struct TextSpecs {
  49.     Str255 theTextFont;
  50.     Style theTextFace;
  51.     short theTextSize;
  52.     RGBColor theTextColor;
  53.     short theJustification;                                /* record justification */
  54.     RGBColor theBackColor;                                /* Window's background color */
  55. };
  56. typedef TextSpecs *TextSpecsPtr;
  57. typedef TextSpecsPtr *TextSpecsHdl;
  58.  
  59. class TMovieView;
  60.  
  61. class TDemoTextApplication : public TApplication {
  62.   public:
  63.  
  64.     virtual pascal void IDemoTextApplication(void);
  65.                 /* Initialize the Application */
  66.  
  67.     virtual pascal TDocument *DoMakeDocument(CmdNumber itsCmdNumber);
  68.                 /* Launches a TTextDocument */
  69.  
  70. #if  qDebug
  71.     virtual pascal void IdentifySoftware(void);
  72. #endif
  73.  
  74. };
  75.  
  76. class TTextDocument : public TDocument {
  77.   public:
  78.  
  79.     Handle fDocText;                                    /* The text owned by the document */
  80.     TEStyleHandle fStyles;                                /* Style handle, if any */
  81.     STHandle fElements;                                    /* Handle to element array, if any */
  82.     TTEView *fTEView;                                    /* The view which displays the text */
  83.     TMovieView *fMovieView;
  84.     FSSpec        fFSSpec;
  85.     Boolean        fHasMovie;
  86.  
  87.     TextSpecs fTextSpecs;                                /* Specifies properties of the text */
  88.  
  89.                         /* Initialization and freeing */
  90.  
  91.     virtual pascal void ITextDocument(void);
  92.     virtual pascal void Free(void);
  93.     virtual pascal void DoInitialState(void);
  94.     virtual pascal void FreeData(void);
  95.     virtual pascal void DoMakeWindows();
  96.  
  97.                         /* Filing */
  98.  
  99.     virtual pascal void DoNeedDiskSpace(long *dataForkBytes, long *rsrcForkBytes);
  100.     virtual pascal void DoRead(short aRefNum, Boolean rsrcExists, Boolean forPrinting);
  101.     virtual pascal void DoWrite(short aRefNum, Boolean makingCopy);
  102.  
  103.                         /* Making views and windows */
  104.  
  105.     virtual pascal void DoMakeViews(Boolean forPrinting);
  106.  
  107.                         /* Command processing */
  108.  
  109.     virtual pascal TCommand *DoMenuCommand(CmdNumber aCmdNumber);
  110.     virtual pascal void DoSetupMenus(void);
  111.  
  112.                         /* Auxiliary routines */
  113.  
  114.     virtual pascal void ChangeBackColor(RGBColor *newColor);
  115.  
  116.     virtual pascal void SetSpecStyle(void);
  117.  
  118.     virtual pascal void ShowReverted(void);
  119.                 /* When the user reverts a document, this is called after reading
  120.                   the old document and before displaying it. Causes the reverted
  121.                   font specs to be installed. */
  122.  
  123.                 /* Debugging */
  124.     virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short 
  125.        fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
  126.  
  127. };
  128.  
  129. class TJustCommand : public TCommand {
  130.   public:
  131.     TTEView *fTEView;
  132.     short fOldJust;
  133.     short fNewJust;
  134.  
  135.     virtual pascal void IJustCommand(TTEView *itsTEView, short itsNewJust);
  136.  
  137.     virtual pascal void DoIt(void);
  138.  
  139.     virtual pascal void RedoIt(void);
  140.  
  141.     virtual pascal void UndoIt(void);
  142.  
  143.     virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short 
  144.        fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
  145. };
  146.  
  147. class TMovieView : public TView {
  148.   public:
  149.       Movie    fMovie;
  150.     short    fMovieResRefNum;
  151.     Str255    fMovieName;
  152.     short    fActualResID;
  153.     FSSpec    fMovieFSSpec;
  154.     MovieController    fMC;
  155.     virtual pascal void IRes(TDocument *itsDocument, TView *itsSuperView, Ptr *itsParams);
  156.     virtual pascal void Draw(Rect *area);
  157.     virtual pascal TCommand* DoMouseCommand(Point* /* theMouse */, EventInfo* info, Point* /*hysteresis*/);
  158.     virtual pascal void DoSetMovie(Movie theMovie);
  159.     virtual pascal Boolean DoIdle(IdlePhase phase);
  160.     virtual pascal void Free();
  161. };
  162.  
  163. class TImportMovieCommand : public TCommand {
  164.     private:
  165.     TMovieView    *fMovieView;
  166.     public:
  167.     virtual pascal void IImportMovie(TMovieView *itsView, TTextDocument *itsDocument);
  168.     virtual pascal void DoIt();
  169. };